<%@page import="com.kensure.shike.sys.model.SKDict"%>
<%@page import="java.util.List"%>
<%@page import="com.kensure.shike.sys.service.SKDictService"%>
<%@page import="com.kensure.shike.constant.BusiConstant"%>
<%@page import="co.kensure.api.ApiUtil"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"	pageEncoding="UTF-8"%>

<!DOCTYPE html>
<html>
<jsp:include page="base/header.jsp" flush="true"> 
 <jsp:param value="订单管理" name="pageTitle"/>
</jsp:include>

<!--必要样式-->
<link rel="stylesheet" href="<%=BusiConstant.context%>/common/css/style.css" type="text/css" />
<body>
<jsp:include page="base/nav.jsp" flush="true"></jsp:include>
<%	
	String status = request.getParameter("status"); 
	if(status == null){
		status = "";
	}
%>
<style>

.shiy_tl{height:32px;margin: 20px 0 10px 0;}
.shiy_tl a{border-bottom: 2px solid #e8e8e8; width: 112px; height: 30px; line-height: 30px; text-align: center; float: left; font-size: 16px;color: #666;text-decoration:none}
.shiy_tl a:hover{ border-bottom: 2px solid #ff464e; color:#ff464e;}
.shiy_tl a i{ float: right;color: #e8e8e8;}
.shiy_tl a.shiy{border-bottom: 2px solid #ff464e; width: 112px; color:#ff464e; font-size:16px;/*border-bottom: none;*/height: 30px; line-height: 30px;font-weight: bold;}

</style>

<div id="content" style="margin-left:20px;font-size:12px;">
	<br>
    <div style="height:40px;">
	    <form id="chaxun">
	    <span style="float:none;margin-right:5px;">订单号</span>
         <input name="code" type="text" style="width:200px" >
	    
	    <input onclick="huodonglist(1)" type="button" value="搜索">
        </form>
    </div>
  
   
    <div >
    	<div class="shiy_tl">
			<a href="<%=BusiConstant.context%>/gl/orderlist" class='<%="".equalsIgnoreCase(status)?"shiy":""%>' >全部</a>
			<a href="<%=BusiConstant.context%>/gl/orderlist?status=0" class='<%="0".equalsIgnoreCase(status)?"shiy":""%>'>等待买家付款</a>
			<a href="<%=BusiConstant.context%>/gl/orderlist?status=1" class='<%="1".equalsIgnoreCase(status)?"shiy":""%>'>未使用</a>
			<a href="<%=BusiConstant.context%>/gl/orderlist?status=99" class='<%="99".equalsIgnoreCase(status)?"shiy":""%>'>已使用</a>
			<a href="<%=BusiConstant.context%>/gl/orderlist?status=-1" class='<%="-1".equalsIgnoreCase(status)?"shiy":""%>'>关闭的订单</a>
    	</div>

      <div>	
         	<table id="headtable">
         		<thead></thead>
             	<tbody></tbody>
            </table>
        </div>
        <div id="fanye"></div>
    </div>
</div>

</body>



<script>

	var imgtdfun = function(row){
		 var order = row.orderList[0];
		var tdinner = order.title+order.yanse;
		return tdinner;
	}
	
	var table = createtable("headtable");
	table.th = [{w:100,na:"编号",colname:"id"}
	,{w:300,na:"商品",callfun:imgtdfun}
	,{w:80,na:"价格",callfun:function(row){
		var order = row.orderList[0];
		return order.salePrice;
	}}
	,{w:180,na:"订单号",colname:"code"}
	,{w:180,na:"下单时间",colname:"createdTimeStr"}
	,{w:100,na:"电话",colname:"sjphone"}
	,{w:100,na:"联系人",colname:"sjrname"}
	,{w:200,na:"区域",callfun:function(row){
		return row.sheng+row.shi+row.xian;
	}}
	,{w:100,na:"状态",colname:"statusStr"}
	,{w:300,na:"使用说明",callfun:function(row){
		var order = row.orderList[0];
		return order.content;
	}}];
	
	table.thinit();
	
	function sucdo(data){
		var rows = data.resultData.rows;
		fanye.init(data.resultData.total);	
		if(rows){	
			table.data = rows;
			table.tdinit();		
		}	
	}

	var fanye = new FanYe("fanye","huodonglist",0,20,1);
	
   function huodonglist(current){
	   if(!fanye.setpage(current)){
			return;
	   }
	   var data = formtojson($('#chaxun'));
	   data.status = '<%=status%>';
	   data.pageNo = fanye.current;
	   data.pageSize = fanye.limit;
	   var url = getbaseurl("/order/hdlist.do");
	   postdo(url, data, sucdo,null, null);
   }
   huodonglist(1);
   
 
   
   function kddh(id){	    
	   var str = window.prompt("请输入快递单号","");
	   if(str){
		   var data = {id:id,kddh:str};
		   var url = getbaseurl("/order/kddh.do");
		   var s = function(redata){
			   huodonglist(fanye.current);
		   }
		   postdo(url, data,s,null, null);
	   }	  
   } 
   
   function zdfh(id){	    
	   if(confirm('确认自动发货，订单会自动推送到快递公司？')){
		   var data = {id:id};
		   var url = getbaseurl("/order/zdfh.do");
		   var s = function(redata){
			   huodonglist(fanye.current);
		   }
		   postdo(url, data,s,null, null);
	   }	  
   } 
     
</script>


</html>